/**
 * Created with IntelliJ IDEA.
 * User: duoba
 * Date: 16/3/2
 * Time: 上午10:11
 * To change this template use File | Settings | File Templates.
 */

package com.cake21.uitest.Case;

import com.cake21.uitest.Page.CakeListPage;
import com.cake21.uitest.Page.IndexPage;
import com.cake21.uitest.Page.LoginPage;
import com.cake21.uitest.Page.ShoppingCartPage;
import com.cake21.uitest.System.Core.Case;

public class ShoppingCartTest extends Case {

    @Override
    protected void execute() {
        /*21 Cake 主页*/
        IndexPage index = new IndexPage();
        /*确认弹出窗口*/
        index.confirmPopUpBtn();
        /*登陆页面*/
        LoginPage login = index.goLogin();
        /*输入用户名*/
        login.enterUser();
        /*输入密码*/
        login.enterPwd();
        /*点击登陆*/
        login.pressLoginBtn();
        /*蛋糕列表页*/
        CakeListPage cakeList = new CakeListPage();
        /*加入一个蛋糕到购物车*/
        judge.is(cakeList.getOneCakeToCart(), "检查添加购物车是否成功");
        /*购物车页面*/
        ShoppingCartPage sc = new ShoppingCartPage();
        judge.info("购物车截图", screenshot(sc.getDriver()));
        /*从购物车移除一个蛋糕*/
        int removeNumber = sc.removeOneCake();
        judge.is(removeNumber > 0, "检查购物车移除蛋糕是否成功");
    }
}